//
//  CommentView.m
//  Contacts
//
//  Created by 李 雷川 on 14-7-19.
//  Copyright (c) 2014年 李 雷川. All rights reserved.
//

#import "CommentView.h"

@implementation CommentView
@synthesize commentField,commentBtn;
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        UIImage *bgImage = [UIImage imageNamed:@"comment_bg.png"];
        UIImageView *inputBGImageView = [[UIImageView alloc]initWithFrame:CGRectMake(20,12,160,29)];
        inputBGImageView.image = [bgImage stretchableImageWithLeftCapWidth:20 topCapHeight:20];
        inputBGImageView.userInteractionEnabled = YES;
        [self addSubview:inputBGImageView];
        
        
        
        UIImage *inputLogoImage = [UIImage imageNamed:@"comment_icon.png"];
        UIImageView *inputLogoImageView = [[UIImageView alloc]initWithFrame:CGRectMake(4,4,21,21)];
        inputLogoImageView.image = inputLogoImage;
        [inputBGImageView addSubview:inputLogoImageView];
        
       commentField = [[UITextField alloc]initWithFrame:CGRectMake(CGRectGetMaxX(inputLogoImageView.frame), 0,CGRectGetWidth(inputBGImageView.frame) -CGRectGetMaxX(inputLogoImageView.frame), CGRectGetHeight(inputBGImageView.frame))];
        commentField.borderStyle = UITextBorderStyleNone;
        [inputBGImageView addSubview:commentField];
        
        commentBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        UIImage *commentImage = [UIImage imageNamed:@"join.png"];
        commentBtn.frame = CGRectMake(CGRectGetWidth(self.frame) - commentImage.size.width -10,(CGRectGetHeight(self.frame) -commentImage.size.height)/2 ,commentImage.size.width,commentImage.size.height);
        [commentBtn setImage:commentImage forState:UIControlStateNormal];
        [self addSubview:commentBtn];
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
